package xyz.scootaloo.oj.offer

import org.junit.Test

/**
 * @author flutterdash@qq.com
 * @since 2021/4/8 17:04
 */
class P03 {

    private fun findRepeatNumber(nums: IntArray): Int {
        nums.sort()
        for (idx in 1..nums.size) {
            if (nums[idx] == nums[idx - 1])
                return nums[idx]
        }
        return -1 // not found
    }

    @Test
    fun test() {
        print(findRepeatNumber(intArrayOf(2, 3, 1, 0, 2, 5, 3)))
    }

}
